﻿<%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/Master_Page/Master_IPORT.Master" CodeBehind="Online-Payment.aspx.vb" Inherits="I_PORT.Online_Payment" MaintainScrollPositionOnPostback="true"
    title="IRPC INTELLIGENT PORT SERVICE" %>
    
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<script type="text/javascript" language="javascript" >
        function closeModal(type) {
           // document.getElementById('ctl00_contentplaceholder1_framePopup').src = 'about:blank';
            if (type == 'X')
            {
            var mpu = $find('ctl00_ContentPlaceHolder1_ModalPopupExtender7');
            document.getElementById('ctl00_contentplaceholder1_btnLoadPayin').click();
            mpu.hide();
            }
        }
</script>
<asp:UpdatePanel ID="UpdatePanelOnlinePayment" runat="server" >
<ContentTemplate>
   <table width="98%" border="0" cellpadding="0" cellspacing="0" >
     <tr>
       <td style="height:5px;"><img src="../Image/space.gif" /></td>
     </tr>
     <tr>
       <td align="left">
           <asp:TabContainer ID="TabPayment" runat="server"  Width="100%" 
               AutoPostBack="true"  ActiveTabIndex="0" >
           <asp:TabPanel  ID="TabAdvanced" runat="server"  HeaderText="Advanced Payment"><HeaderTemplate>Advanced Payment</HeaderTemplate><ContentTemplate>
           <table width="100%" border="0" cellpadding="0" cellspacing="0"><tr>
           <td align="center"><asp:Panel ID="panelGridItem" runat="server" Width="900px" ScrollBars="Horizontal"><asp:GridView ID="gridItem" runat="server" SkinID="gridblue" DataKeyNames="Status,Booking_Code,Booking_name,Vehicle_no,Vehicle_Text,Booking_no,Date_From,Date_To,MAgent_no,MAgent_name,SAgent_no,SAgent_name,MKT_Product,MKT_Custom,MKT_Finance,Booking_Date,Booking_Time,VPS_approve,MRI_approve,Marketing_approve,Vps_Acknowledge,MKT_Acknowledge,Remark_VPS,Remark_MRI,Vehicle_Destination,Vehicle_TypeBuy,Demurrage,Demurrage_Money,BunkerFO_Point,BunkerDO_Point" AutoGenerateColumns="False"><Columns><asp:TemplateField><ItemTemplate><asp:LinkButton ID="LinkBooking" runat="server" Text="ชำระค่าบริการ" CommandArgument="<%# Container.DataItemIndex %>" CommandName="Edit" ></asp:LinkButton></ItemTemplate><ItemStyle Wrap="False"></ItemStyle></asp:TemplateField><asp:BoundField HeaderText="BOOKING NO." DataField="Booking_no" ><ItemStyle Wrap="False"></ItemStyle></asp:BoundField><asp:BoundField HeaderText="LAY CAN/LAY DAY" DataField="Date_To" ><ItemStyle Wrap="False"></ItemStyle></asp:BoundField><asp:BoundField HeaderText="วันเวลา/จองเข้า" DataField="Lay_Time" ><ItemStyle Wrap="False"></ItemStyle></asp:BoundField><asp:BoundField HeaderText="LAY TIME" DataField="Lay_Time" ><ItemStyle Wrap="False"></ItemStyle></asp:BoundField><asp:BoundField HeaderText="Vessel NAME" DataField="Vehicle_Text" ><ItemStyle Wrap="False"></ItemStyle></asp:BoundField><asp:BoundField HeaderText="เอกสารรายละเอียด" DataField="File_Upload"><ItemStyle Wrap="False"></ItemStyle></asp:BoundField><asp:BoundField HeaderText="COMMODITY" DataField="Product_Name" ><ItemStyle Wrap="False"></ItemStyle></asp:BoundField><asp:BoundField HeaderText="QUANTITY" DataField="Product_Amount"><ItemStyle Wrap="False"></ItemStyle></asp:BoundField><asp:BoundField HeaderText="UNIT" DataField="Product_Unit" ><ItemStyle Wrap="False"></ItemStyle></asp:BoundField><asp:BoundField HeaderText="BUYER" DataField="BUYER" ><ItemStyle Wrap="False"></ItemStyle></asp:BoundField><asp:BoundField HeaderText="SALLER" DataField="SELLER"><ItemStyle Wrap="False"></ItemStyle></asp:BoundField><asp:BoundField HeaderText="Status" DataField="Status_Text" Visible="False" /><asp:TemplateField  Visible="false" HeaderText="Product"><ItemTemplate><asp:Image ID="imgProduct" runat="server" />
               </ItemTemplate><ItemStyle Width="40px"></ItemStyle></asp:TemplateField><asp:TemplateField Visible="false" HeaderText="Custom"><ItemTemplate><asp:Image ID="imgCustom" runat="server" />
               </ItemTemplate><ItemStyle Width="40px"></ItemStyle></asp:TemplateField><asp:TemplateField Visible="false" HeaderText="Finace"><ItemTemplate><asp:Image ID="imgFinance" runat="server" />
               </ItemTemplate><ItemStyle Width="40px"></ItemStyle></asp:TemplateField><asp:BoundField  Visible="false" HeaderText="DEMURRAGE" DataField="Lay_Time" /><asp:BoundField  Visible="false" HeaderText="TERM" DataField="Lay_Time" /><asp:TemplateField  Visible="false" HeaderText="VPS"><ItemTemplate><asp:Image ID="imgVPS" runat="server" />
               </ItemTemplate><ItemStyle Width="40px"></ItemStyle></asp:TemplateField><asp:TemplateField  Visible="false" HeaderText="MRI"><ItemTemplate><asp:Image ID="imgMRI" runat="server" />
               </ItemTemplate><ItemStyle Width="40px"></ItemStyle></asp:TemplateField><asp:TemplateField  Visible="false" HeaderText="MKT"><ItemTemplate><asp:Image ID="imgMKT" runat="server" /></ItemTemplate><ItemStyle Width="40px"></ItemStyle></asp:TemplateField><asp:BoundField HeaderText="AGENT" DataField="MAgent_name" /><asp:BoundField HeaderText="เทียบท่า" Visible="false" />
                                                    <asp:BoundField HeaderText="วันเทียบ" Visible="false" />
                                                    <asp:BoundField HeaderText="เวลาเทียบ" Visible="false" />
                                                    <asp:BoundField HeaderText="เวลาเทียบ" Visible="false"/>
                                                    <asp:BoundField HeaderText="เวลาเทียบ" Visible="false" /><asp:BoundField  Visible="false" HeaderText="REMAIN LAYTIME"  /><asp:BoundField  Visible="false" HeaderText="REMARK" /></Columns><PagerTemplate><table><tr><td><asp:ImageButton ID="ImgFirst" runat="server" Height="22px" ImageUrl="../Image/arrow-first.gif"
                                                            OnCommand="Paginate" CommandArgument="First" CommandName="Page" /></td><td><asp:ImageButton ID="ImgBack" runat="server" Height="22px" ImageUrl="../Image/arrow-back.gif"
                                                            OnCommand="Paginate" CommandArgument="Prev" CommandName="Page" /></td><td valign="top">Page <asp:DropDownList ID="ddlPage" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlPage_SelectedIndexChanged"></asp:DropDownList>of <asp:Label ID="lbPageCount" runat="server" Text="Label"></asp:Label></td><td><asp:ImageButton ID="ImgNext" runat="server" Height="22px" ImageUrl="../Image/arrow-next.gif"
                                                            OnCommand="Paginate" CommandArgument="Next" CommandName="Page" /></td><td><asp:ImageButton ID="ImgEnd" runat="server" Height="22px" ImageUrl="../Image/arrow-end.gif"
                                                            OnCommand="Paginate" CommandArgument="Last" CommandName="Page" /></td></tr></table></PagerTemplate></asp:GridView></asp:Panel><asp:Label ID="lbAlert" runat="server" Font-Names="Tahoma"  style="color:Red; font-size:16px;" Visible="False"></asp:Label></td></tr></table></ContentTemplate></asp:TabPanel>
           <asp:TabPanel ID="TabCNDN" runat="server" HeaderText="INV./CN/DN"><ContentTemplate>
                <table width="100%" border="0" cellpadding="2" cellspacing="0">
                     <tr>
                         <td align="center">
                             <fieldset style="width:95%"><legend style="color:#848585; font-family:Tahoma;font-size:14px;font-weight:bold;">Vat & Non-Vat</legend>
                             <table width="95%" border="0" cellpadding="0" cellspacing="0">
                             <tr><td style="height:5px;"> <img src="../Image/space.gif" /></td></tr>
                             <tr>
                                <td>
                                <asp:Panel ID="panel1" runat="server" Width="800px" ScrollBars="Horizontal">
                                <asp:GridView ID="gridCNDN" runat="server" ShowFooter="true" SkinID="gridblueNoPage" DataKeyNames="BUKRS,BELNR,GJAHR,BUZEI,BILL_TO,MWSKZ,BLART,DOC_DESC,XBLNR,ALLOC_NMBR,BLDAT,DUEDT,WAERS,BASMAT,VAT,NETAMT,WHTAMT,TEXT40,REBZG,REBZJ,REBZZ,Booking_no,Ship_Name"
                                                                    AutoGenerateColumns="False">
                                                                    <Columns>
                                                                        <asp:TemplateField HeaderText="Select">
                                                                            <ItemTemplate>
                                                                                <asp:CheckBox ID="chkCNDN" runat="server" AutoPostBack="true" OnCheckedChanged="chkCNDN_CheckedChanged" /></ItemTemplate>
                                                                            <ItemStyle Width="50px" />
                                                                        </asp:TemplateField>
                                                                        <asp:BoundField HeaderText="ประเภทเอกสาร" DataField="TYPE_DOC" >
                                                                            <ItemStyle HorizontalAlign="Left" Wrap="False" />
                                                                        </asp:BoundField>
                                                                        <asp:BoundField HeaderText="เอกสารอ้างอิง" DataField="ALLOC_NMBR" ItemStyle-Wrap="false" />
                                                                        <asp:BoundField HeaderText="BILL TO" DataField="BILL_TO" />
                                                                        <asp:BoundField HeaderText="วันที่เอกสาร" DataField="BLDAT" />
                                                                        <asp:BoundField HeaderText="วันที่กำหนดชำระ" DataField="DUEDT" />
                                                                        <asp:BoundField HeaderText="สกุลเงิน" DataField="WAERS" />
                                                                        <asp:BoundField HeaderText="จำนวนเงิน" DataField="BASMAT" />
                                                                        <asp:BoundField HeaderText="ภาษีมูลค่าเพิ่ม" DataField="VAT" />
                                                                        <asp:BoundField HeaderText="ยอดคงค้างสุทธิ" />
                                                                        <asp:BoundField HeaderText="ภาษีหัก ณ ที่จ่าย" DataField="WHTAMT" />
                                                                        <asp:BoundField HeaderText="ประเภทภาษีหัก ณ ที่จ่าย" DataField="TEXT40" />
                                                                        <asp:BoundField HeaderText="สถานะ" ItemStyle-Wrap="false"  />
                                                                        <asp:BoundField HeaderText="จำนวนวันที่เกินกำหนด" />
                                                                    </Columns>
                                                                </asp:GridView>
                         <asp:Label ID="lbAlertVat" runat="server" Font-Names="Tahoma"  style="color:Red; font-size:16px;" Visible="False"></asp:Label>
                                </asp:Panel>
                                
                         </td>
                         </tr>
                         <tr>
                         <td style="height:5px;"><img src="../Image/space.gif" /></td>
                         </tr>
                         <tr><td align="left">
                         <table width="100%" border="0" cellpadding="2" cellspacing="0" >
                         <tr>
                                                                        <td style="width: 20%;" align="right">
                                                                            <asp:Label ID="Label9" runat="server" Text="จำนวนเงินสุทธิ :" SkinID="lbtxt"></asp:Label>&nbsp;
                                                                        </td>
                                                                        <td align="left">
                                                                           <asp:Label ID="lbMoneyCNDN" runat="server" Text="" SkinID="lbtxt"></asp:Label>
                                                                        </td>
                                                                    </tr>
                             <tr>
                                <td style="width:20%;" align="right">
                                    <asp:Label ID="Label1" runat="server" Text="ธนาคาร :" SkinID="lbtxt" ></asp:Label>&nbsp;
                               </td>
                               <td align="left">
                                    <asp:DropDownList ID="ddlBankOX" runat="server" SkinID="ddl" AutoPostBack="true">
                                    <asp:ListItem Value="0"><--กรุณาเลือกธนาคาร--></asp:ListItem>
                                    <asp:ListItem Value="KBANK">ธนาคารกสิกรไทย</asp:ListItem>
                                    <asp:ListItem>ธนาคาร</asp:ListItem></asp:DropDownList>
                               </td>
                            </tr>
                            <tr>
                                <td style="width:20%;" align="right">
                                    <asp:Label ID="Label4" runat="server" Text="บัญชี :" SkinID="lbtxt" ></asp:Label>&nbsp;
                               </td>
                               <td align="left">
                                     <asp:DropDownList ID="ddlAccountOX" runat="server" SkinID="ddl">
                                    </asp:DropDownList>
                               </td>
                            </tr>
                            <tr>
                            <td style="width:20%;" align="right"><asp:Label  ID="Label3" runat="server" SkinID="lbtxt" ></asp:Label>&nbsp;</td><td align="left">
                       <asp:Button ID="btnPayOX" runat="server" CssClass="ButtonStyle" Text="ชำระเงิน" /></td>
                       </tr>
                       </table>
                       </td>
                     </tr>
                     <tr><td style="height:5px;"><img src="../Image/space.gif" /></td>
                    </tr>
                   </table>
                   </fieldset> 
                  </td>
               </tr>
               <tr>
               <td style="height:5px;"><img src="../Image/space.gif" /></td>
              </tr>
              <tr>
                <td align="center">
                       <fieldset style="width:95%">
                       <legend style="color:#848585; font-family:Tahoma;font-size:14px;font-weight:bold;">Deferred Vat</legend>
                       <table width="90%" border="0" cellpadding="0" cellspacing="0" >
                       <tr><td style="height:5px;"><img src="../Image/space.gif" /></td></tr>
                       <tr><td align="center">
                       <asp:Panel ID="panel2" runat="server" Width="800px" ScrollBars="Horizontal">
                       <asp:GridView ID="gridDefferred" runat="server" ShowFooter="true" SkinID="gridblueNoPage" DataKeyNames="BUKRS,BELNR,GJAHR,BUZEI,BILL_TO,MWSKZ,BLART,DOC_DESC,XBLNR,ALLOC_NMBR,BLDAT,DUEDT,WAERS,BASMAT,VAT,NETAMT,WHTAMT,TEXT40,REBZG,REBZJ,REBZZ,Booking_no,Ship_Name"
                                                                    AutoGenerateColumns="False">
                                                                    <Columns>
                                                                        <asp:TemplateField HeaderText="Select">
                                                                            <ItemTemplate>
                                                                                <asp:CheckBox ID="chkCNDN" runat="server" AutoPostBack="true" OnCheckedChanged="chkDefferred_CheckedChanged"  /></ItemTemplate>
                                                                            <ItemStyle Width="50px" />
                                                                        </asp:TemplateField>
                                                                        <asp:BoundField HeaderText="ประเภทเอกสาร" DataField="TYPE_DOC" >
                                                                            <ItemStyle HorizontalAlign="Left" Wrap="False" />
                                                                        </asp:BoundField>
                                                                        <asp:BoundField HeaderText="เอกสารอ้างอิง" DataField="ALLOC_NMBR" />
                                                                        <asp:BoundField HeaderText="BILL TO" DataField="BILL_TO" />
                                                                        <asp:BoundField HeaderText="วันที่เอกสาร" DataField="BLDAT" />
                                                                        <asp:BoundField HeaderText="วันที่กำหนดชำระ" DataField="DUEDT" />
                                                                        <asp:BoundField HeaderText="สกุลเงิน" DataField="WAERS" />
                                                                        <asp:BoundField HeaderText="จำนวนเงิน" DataField="BASMAT" />
                                                                        <asp:BoundField HeaderText="ภาษีมูลค่าเพิ่ม" DataField="VAT" />
                                                                        <asp:BoundField HeaderText="ยอดคงค้างสุทธิ" />
                                                                        <asp:BoundField HeaderText="ภาษีหัก ณ ที่จ่าย" DataField="WHTAMT" />
                                                                        <asp:BoundField HeaderText="ประเภทภาษีหัก ณ ที่จ่าย" DataField="TEXT40" />
                                                                        <asp:BoundField HeaderText="สถานะ" ItemStyle-Wrap="false"  />
                                                                        <asp:BoundField HeaderText="จำนวนวันที่เกินกำหนด" />
                                                                    </Columns>
                                                                </asp:GridView>
                   <asp:Label ID="lbAlertDeferred" runat="server" Font-Names="Tahoma"  style="color:Red; font-size:16px;" Visible="False"></asp:Label>
                       </asp:Panel>
                        </td></tr><tr><td style="height:5px;"><img src="../Image/space.gif" /></td></tr><tr><td align="left">
                   <table width="100%" border="0" cellpadding="2" cellspacing="0" >
                    <tr>
                                                                        <td style="width: 20%;" align="right">
                                                                            <asp:Label ID="Label10" runat="server" Text="จำนวนเงินสุทธิ :" SkinID="lbtxt"></asp:Label>&nbsp;
                                                                        </td>
                                                                        <td align="left">
                                                                           <asp:Label ID="lbMoneyDeferred" runat="server" Text="" SkinID="lbtxt"></asp:Label>
                                                                        </td>
                                                                    </tr>
                       <tr>
                          <td style="width:20%;" align="right">
                              <asp:Label ID="lbBank" runat="server" Text="ธนาคาร :" SkinID="lbtxt" ></asp:Label>&nbsp;
                          </td> 
                          <td align="left">
                               <asp:DropDownList ID="ddlBankDS" runat="server" SkinID="ddl" AutoPostBack="true">
                               <asp:ListItem Value="0"><--กรุณาเลือกธนาคาร--></asp:ListItem>
                               <asp:ListItem Value="KBANK">ธนาคารกสิกรไทย</asp:ListItem>
                               <asp:ListItem>ธนาคาร</asp:ListItem></asp:DropDownList>
                           </td>
                         </tr>
                         <tr>
                                <td style="width:20%;" align="right">
                                    <asp:Label ID="Label5" runat="server" Text="บัญชี :" SkinID="lbtxt" ></asp:Label>&nbsp;
                               </td>
                               <td align="left">
                                     <asp:DropDownList ID="ddlAccountDS" runat="server" SkinID="ddl">
                                    </asp:DropDownList>
                               </td>
                            </tr>
                         <tr><td style="width:20%;" align="right"><asp:Label ID="Label2" runat="server" SkinID="lbtxt" ></asp:Label>&nbsp;</td><td align="left">
                       <asp:Button ID="btnPayDS" runat="server" CssClass="ButtonStyle" Text="ชำระเงิน" />
                       </td>
                      </tr>
                    </table></td></tr><tr><td style="height:5px;"><img src="../Image/space.gif" /></td></tr></table></fieldset> </td></tr></table></ContentTemplate></asp:TabPanel>
          <asp:TabPanel ID="TabRecord" runat="server" HeaderText="Payment Record">
              <ContentTemplate>
                  <table width="100%" border="0" cellpadding="2" cellspacing="0">
                       <tr>
                          <td align="center"><fieldset style="width:95%"><legend style="color:#848585; font-family:Tahoma;font-size:14px;font-weight:bold;">Payment Record</legend>
                          <table width="95%" border="0" cellpadding="0" cellspacing="0">
                             <tr>
                                <td style="height:5px;"><img src="../Image/space.gif" /></td>
                            </tr>
                            <tr>
                               <td>
                                <asp:Panel ID="panel3" runat="server" Width="800px" ScrollBars="Horizontal">
                                <asp:GridView ID="gridRecord" runat="server" SkinID="gridblueNoPage" DataKeyNames="BUKRS,BELNR,GJAHR,BUZEI,BILL_TO,MWSKZ,BLART,DOC_DESC,XBLNR,BLDAT,DUEDT,WAERS,BASMAT,VAT,NETAMT,WHTAMT,TEXT40,CLEAR_DATE,CLR_DOC_NO,ADV_YEAR,ADV_DOC_NO"
                                        AutoGenerateColumns="False">
                                                                    <Columns>
                                                                        <asp:BoundField HeaderText="เอกสารอ้างอิง" DataField="ALLOC_NMBR" />
                                                                        <asp:BoundField HeaderText="BILL TO" DataField="BILL_TO" />
                                                                        <asp:BoundField HeaderText="วันที่เอกสาร" DataField="BLDAT" />
                                                                        <asp:BoundField HeaderText="วันที่กำหนดชำระ" DataField="DUEDT" />
                                                                        <asp:BoundField HeaderText="วันที่ชำระ" DataField="CLEAR_DATE" />
                                                                        <asp:BoundField HeaderText="สกุลเงิน" DataField="WAERS" />
                                                                        <asp:BoundField HeaderText="จำนวนเงิน" DataField="BASMAT" />
                                                                        <asp:BoundField HeaderText="ภาษีมูลค่าเพิ่ม" DataField="VAT" />
                                                                        <asp:BoundField HeaderText="ยอดคงค้างสุทธิ" />
                                                                        <asp:BoundField HeaderText="ภาษีหัก ณ ที่จ่าย" DataField="WHTAMT" />
                                                                        <asp:BoundField HeaderText="จำนวนเงินสุทธิ" DataField="NETAMT" />
                                                                        <asp:BoundField HeaderText="ประเภทภาษีหัก ณ ที่จ่าย" DataField="TEXT40" />
                                                                    </Columns>
                                                                </asp:GridView>
                  <asp:Label ID="LabelAlertRecord" runat="server" Font-Names="Tahoma"  style="color:Red; font-size:16px;" Visible="False"></asp:Label>
                                </asp:Panel>
                                  </td></tr>
                            <tr>
                            <td style="height:5px;"><img src="../Image/space.gif" />
                            </td>
                            </tr>
                            </table>
                          </fieldset>
                         </td>
                      </tr>
                      <tr><td style="height:5px;"><img src="../Image/space.gif" /></td></tr>
                      </table>
                      </ContentTemplate>
                   </asp:TabPanel>
           </asp:TabContainer>
       </td>
     </tr>
     <tr>
       <td style="height:5px;"><img src="../Image/space.gif" /></td>
     </tr>
   </table>
      <asp:Button ID="btnPayinTemp" runat="server" Text="Button" style="display:none" />
      <asp:Button ID="btnLoadPayin" runat="server" Text="Button" style="display:none" />
       <asp:ModalPopupExtender ID="ModalPopupExtender7" runat="server" BackgroundCssClass="Background"
     TargetControlID="btnPayinTemp" PopupControlID="PanelPayin" >
    </asp:ModalPopupExtender>
       <asp:Panel ID="PanelPayin" runat="server" Style="display: none;">
        <table>
            <tr>
                <td>
                    <iframe runat="server" id="iframePayin" marginheight="0px"  class="Style-Iframe" marginwidth="0px" >
                    </iframe>
                </td>
            </tr>
        </table>
    </asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
